package cn.java75.vo;


/**
 * @author oldliu
 * @since 1.0
 */
//构建查询条件
public class Condition {
    private String colName;
    private String operator;
    private Object value;
    public Condition(){}

    public Condition(String colName, String operator, Object value) {
        this.colName = colName;
        this.operator = operator;
        this.value = value;
    }

    public String getColName() {
        return colName;
    }

    public void setColName(String colName) {
        this.colName = colName;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public static class Like extends Condition{
        public Like(String colName, Object value){
            super(colName,"like","%"+value+"%");
        }
    }
    public static class Gt extends Condition{
        public Gt(String colName, Object value){
            super(colName,">",value);
        }
    }
    public static class Ge extends Condition{
        public Ge(String colName, Object value){
            super(colName,">=",value);
        }
    }
    public static class Lt extends Condition{
        public Lt(String colName, Object value){
            super(colName,"<",value);
        }
    }
    public static class Le extends Condition{
        public Le(String colName, Object value){
            super(colName,"<=",value);
        }
    }
    public static class ISNULL extends Condition{
        public ISNULL(String colName, Object value){
            super(colName,"is null",null);
        }
    }
}
